package 多线程.多线程创建.线程池;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

public class Test01 {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(2);
//
//        Future<?> submit = executorService.submit(new Ticket());
//
//        Future<String> submit1 = executorService.submit(new Person());
//
//
//        Future<?> submit02 = executorService.submit(new Ticket());
//
//        System.out.println(submit1.get());
//
//        System.out.println(submit.get());
//
//        System.out.println(submit02.get());
//
//        executorService.shutdown();

        executorService.submit(new MyRunnable());
        executorService.submit(new MyRunnable());
        executorService.submit(new MyRunnable());

        executorService.shutdown();

    }
}
